<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://jsptags.com/tags/navigation/pager" prefix="pg"%>
<%
	String path=request.getContextPath();
	String basePath=request.getScheme()+"://"
			+request.getServerName()+":"+request.getServerPort()
			+path+"/";
%>
<!DOCTYPE html>
<html>
<base href="<%=basePath%>">
	<head>
		<title>我的桌面</title>
		<meta charset="utf-8">
		<link rel="icon" href="img/logo.png" sizes="32x32">
		<link rel="stylesheet" href="css/xadmin.css">
		<script type="text/javascript" src="layui/layui.js"></script>
		<script type="text/javascript" src="js/jquery.min.js"></script>
	</head>
	<body>
		<div class="x-body layui-anim layui-anim-up">
			<blockquote class="layui-elem-quote">欢迎管理员：
				<span class="x-red">${currentUser.getUserName() }</span>！当前时间:&nbsp;&nbsp;&nbsp;&nbsp;<span id="datetime"></span>
			</blockquote>
			<fieldset class="layui-elem-field">
				<legend>数据统计</legend>
				<div class="layui-field-box">
					<div class="layui-col-md12">
						<div class="layui-card">
							<div class="layui-card-body">
								<div class="layui-carousel x-admin-carousel x-admin-backlog" lay-anim="" lay-indicator="inside" lay-arrow="none"
								 style="width: 100%; height: 90px;">
									<div carousel-item="">
										<ul class="layui-row layui-col-space10 layui-this">
											<li class="layui-col-xs2">
												<a href="javascript:;" class="x-admin-backlog-body">
													<h3>题目数量</h3>
													<p><cite>${problemCount }</cite></p>
												</a>
											</li>
											<li class="layui-col-xs2">
												<a href="javascript:;" class="x-admin-backlog-body">
													<h3>用户数量</h3>
													<p><cite>${userCount}</cite></p>
												</a>
											</li>
											<li class="layui-col-xs2">
												<a href="javascript:;" class="x-admin-backlog-body">
													<h3>论坛总文章数量</h3>
													<p>
														<cite>${itemCount }</cite></p>
												</a>
											</li>
											<li class="layui-col-xs2">
												<a href="javascript:;" class="x-admin-backlog-body">
													<h3>公告数量</h3>
													<p>
														<cite>${noticeCount }</cite></p>
												</a>
											</li>
											<li class="layui-col-xs2">
												<a href="javascript:;" class="x-admin-backlog-body">
													<h3>题解数量</h3>
													<p>
														<cite>${solutionCount }</cite></p>
												</a>
											</li>
										</ul>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</fieldset>
			<fieldset class="layui-elem-field">
				<legend>系统通知</legend>
				<div class="layui-field-box">
					<table class="layui-table" lay-skin="line">
						<tbody>
							<c:forEach var="notice" items="${noticeList }">
							<tr>
								<td>
									<a class="x-a" href="#" target="_blank"><span style="color: black;">[${notice.getNoticeDate() }]&nbsp;&nbsp;&nbsp;&nbsp;</span>${notice.getNoticeContent() }</a>
								</td>
							</tr>
							</c:forEach>
						</tbody>
					</table>
				</div>
			</fieldset>
			<fieldset class="layui-elem-field">
				<legend>系统信息</legend>
				<div class="layui-field-box">
					<table class="layui-table">
						<tbody>
							<tr>
								<th>系统版本</th>
								<td>1.0.1</td>
							</tr>
							<tr>
								<th>jdk版本</th>
								<td>1.8</td>
							</tr>
							<tr>
								<th>mysql版本</th>
								<td>5.7</td>
							</tr>
							<tr>
								<th>运行环境</th>
								<td>Apache tomcat 8.5.58</td>
							</tr>
						</tbody>
					</table>
				</div>
			</fieldset>
			<fieldset class="layui-elem-field">
				<legend>开发团队</legend>
				<div class="layui-field-box">
					<table class="layui-table">
						<tbody>
							<tr>
								<th>版权所有</th>
								<td>tpw
									<a href="problem/list?pager.offset=0" class='x-a' target="_blank">访问首页</a></td>
							</tr>
							<tr>
								<th>开发者</th>
								<td>tpw(1677909891@qq.com)</td>
							</tr>
						</tbody>
					</table>
				</div>
			</fieldset>
		</div>
		<script type="text/javascript">
			function datetime() {
				//创建日期时间对象
				var datetime = new Date();
				//获取组件
				var year = datetime.getFullYear();
				var month = datetime.getMonth() + 1;
				var day = datetime.getDate();
				var hour = datetime.getHours();
				var minute = datetime.getMinutes();
				var second = datetime.getSeconds();
				var week = datetime.getDay();
				//转换星期格式
				switch (week) {
					case 0:
						var week = '星期日';
						break;
					case 1:
						var week = '星期一';
						break;
					case 2:
						var week = '星期二';
						break;
					case 3:
						var week = '星期三';
						break;
					case 4:
						var week = '星期四';
						break;
					case 5:
						var week = '星期五';
						break;
					case 6:
						var week = '星期六';
						break;
				}
				//小时,分钟,秒如果小于10加上前导零
				if (hour < 10) {
					var hour = 0 + "" + hour;
				}
				if (minute < 10) {
					var minute = 0 + "" + minute;
				}
				if (second < 10) {
					var second = 0 + "" + second;
				}
				//完整时间
				var now = year + "年" + month + "月" + day + "日" + " " + hour + ":" + minute + ":" + second + " " + week;
				//更新内容
				$("#datetime").text(now); //这里是往p标签中添加
			}
			setInterval(datetime, 1000);
		</script>
		<script>
			layui.use('element', function() {
				var $ = layui.jquery,
					element = layui.element;
			});
		</script>
	</body>
</html>


